<template>
  <div>
    <img :src="datalist[0].moduleContent.bannerImgSrc" alt="" class="aloneimg">
    <reassembly v-for="item in redata" :key="item.moduleId" :list='colnum'>
      <van-grid-item v-for="item in item.moduleContent.banners" :key="item.id">
        <img :src="item.bannerImgSrc" alt="" @click="handclick(item.bannerLinkTargetId)">
      </van-grid-item>
    </reassembly>
    <img v-if='datalist[this.endnum]' :src="datalist[this.endnum].moduleContent.bannerImgSrc" alt="" class="aloneimg">
  </div>
</template>
<script>
import reassembly from './reassembly'
export default {
  data () {
    return {
      num: 0,
      colnum: 2,
      insterlist: [],
      endnum: 6,
      endsrc: '',
      redata: []
    }
  },
  components: {
    reassembly
  },
  props: ['datalist'],
  methods: {
    handclick (id) {
      this.$router.push(`/meau/${id}`)
    }
  },
  mounted () {
    this.endnum = this.datalist.length < 7 ? 5 : 6
    this.num = this.datalist.length < 7 ? 1 : 0
    this.redata = this.datalist.slice(3 - this.num, 6 - this.num)
  }
}
</script>
